// -----------------------------
// Author: 		Dhaenens Gert 
// Creation: 	2/19/2014 6:03:12 PM				
// -----------------------------

#ifndef _ShaderCompiler_h
#define _ShaderCompiler_h

#include "DxCommon.h"

namespace DxLib
{

	class IRenderDevice;
	class IVertexShader;
	class IPixelShader;
	class IGeometryShader;
	class IHullShader;
	class IDomainShader;
	class IComputeShader;
	class IEffect;

	struct StreamOutputElement;

	class DXLIB ShaderCompiler
	{
	public:

		static IVertexShader*		CompileVertexFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IPixelShader*		CompilePixelFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IGeometryShader*		CompileGeometryFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IGeometryShader*		CompileGeometryStreamOutputFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, StreamOutputElement* lpElements, UInt32 elementCount, Bool bDebug = false);
		static IHullShader*			CompileHullFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IDomainShader*		CompileDomainFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IComputeShader*		CompileComputeFromFile(IRenderDevice* lpDevice, const TChar* lpFile, const Char* lpEntry, Bool bDebug = false);
		static IEffect*				CompileEffectFromFile(IRenderDevice* lpDevice, const TChar* lpFile, Bool bDebug = false);

		static IVertexShader*		LoadVertexFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IPixelShader*		LoadPixelFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IGeometryShader*		LoadGeometryFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IGeometryShader*		LoadGeometryStreamOutputFromFile(IRenderDevice* lpDevice, const TChar* lpFile, StreamOutputElement* lpElements, UInt32 elementCount);
		static IHullShader*			LoadHullFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IDomainShader*		LoadDomainFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IComputeShader*		LoadComputeFromFile(IRenderDevice* lpDevice, const TChar* lpFile);
		static IEffect*				LoadEffectFromFile(IRenderDevice* lpDevice, const TChar* lpFile);

	private:

		static Bool					CompileFromFile(const TChar* lpFile, const Char* lpProfile, const Char* lpEntry, Bool bDebug, void** lpByteCode, SizeT* lpByteCodeSize);
		static Bool					LoadFromFile(const TChar* lpFile, void** lpByteCode, SizeT* lpByteCodeSize);

		ShaderCompiler();
		~ShaderCompiler();
		ShaderCompiler(const ShaderCompiler& refShaderCompiler);
		ShaderCompiler& operator=(const ShaderCompiler& refShaderCompiler);
	};

}

#endif